package com.fizzkai.p2p.core.domain;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

@Getter@Setter
public class SystemDictionaryItem extends BaseDomain {
    //只是用到了他们的Id,所以不用写他们得关联对象
    private Long parentId;//分类ID
    private String title;//名称
    private int sequence;//顺序

    public String getJsonString() throws Exception{
        HashMap<String, Object> map = new HashMap<>();
        map.put("title", title);
        map.put("sequence", sequence);
        map.put("parentId", parentId);
        map.put("id", getId());
        return new ObjectMapper().writeValueAsString(map);
    }
}
